home *** CD-ROM | disk | FTP | other *** search
- Path: atglab.bls.com!Alun.Champion
- From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
- Newsgroups: comp.lang.c
- Subject: Re: What should be returned?
- Date: 17 Jan 1996 17:10:38 GMT
- Organization: Computer People Inc.
- Message-ID: <ALUN.CHAMPION.96Jan17121038@g7240065.bridge.bst.bls.com>
- References: <4dj8pv$cjd@eng_ser1.erg.cuhk.hk>
- NNTP-Posting-Host: bstfirewall.bst.bls.com
- In-reply-to: phsung@cs.cuhk.hk's message of 17 Jan 1996 16:40:31 GMT
-
- In article <4dj8pv$cjd@eng_ser1.erg.cuhk.hk> phsung@cs.cuhk.hk (the CAReLess boy) writes:
-
- : Hi, all,
-
- : It's said that the function main must return an integer value
- : but I just don't know what value should be returned. Also, if I quit
- : main by exit(), what's the use of the return value?
-
- The integer value is dependent on the host environment. This being the case
- the standard requires two macros to be defined in stdlib.h, namely
- EXIT_SUCCESS and EXIT_FAILURE, to provide the correct return values from
- you program.
-
- A return from main() is equivalent to an exit(). Personally I prefer the
- return, an explicit call to exit(), to me, implies something has gone
- wrong in the program from which it can't recover and has no neat means of
- completing the program so must call exit().
-
- Regards
-
- -A.
- --
- | A.Champion |
-